<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
  <!ENTITY dc "http://purl.org/dc/elements/1.1/">
  <!ENTITY dcterms "http://purl.org/dc/terms/">
  <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
  <!ENTITY a "http://xmlns.heustics.org/schema/myelin/0.1/">
  <!ENTITY m "http://xmlns.heustics.org/ontology/myelin/0.1/">
]>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:l="http://xmlns.heustics.org/schema/i18n/0.1/"
  xmlns:a="&a;"
  xmlns:o="&a;GroupAccount#search-members"
  exclude-result-prefixes="xsl a o l"
> 
  <xsl:variable name="o:l10n" select="a:get-l10n('&a;GroupAccount#search-members')"/>
  <xsl:variable name="o:params-l10n" select="$o:l10n/l:context[@name='params']/*"/>
  <xsl:variable name="o:hints-l10n" select="$o:l10n/l:context[@name='param-hints']/*"/>  
   
  <xsl:template match="a:type" mode="a:input-show" name="o:type">
    <xsl:param name="type-l10n" select="$o:l10n/l:context[@name='type-options']/*"/>
       
    <div class="input select type">
      <div class="key">
        <div>
          <xsl:call-template name="a:label-class-attr"/>
          <span><xsl:value-of select="$o:params-l10n[@key='type']"/></span>
          <div class="spacer"/>
        </div>        
        <div class='hint'>
          <xsl:call-template name="a:input-hints">
            <xsl:with-param name="hint" select="$o:hints-l10n[@key='type']"/>
          </xsl:call-template>
          <div class="spacer"/>
        </div>
      </div>  
      <div class="value">
        <select name="type">
          <xsl:variable name="n" select="number(@selected)"/>
          <xsl:for-each select="$type-l10n">
            <xsl:variable name="p" select="position()-1"/>
            <option value="{$p}">
              <xsl:if test="$n = $p">
                <xsl:attribute name="selected">selected</xsl:attribute>
              </xsl:if>
              <xsl:value-of select="."/>
            </option>
          </xsl:for-each>
        </select>    
        <div class="spacer"/>    
      </div>    
      <div class="spacer"/>
    </div>
  </xsl:template>  
  
  <xsl:template match="a:mbox" mode="a:input-show" name="o:mbox-input">
    <xsl:param name="params-l10n" select="$o:params-l10n"/>
    <xsl:param name="hints-l10n" select="$o:hints-l10n"/> 
    <div class='input text mbox'>  
      <div class="key">
        <div>
          <xsl:call-template name="a:label-class-attr"/>
          <span><xsl:value-of select="$params-l10n[@key='mbox']"/></span>
          <div class="spacer"/>
        </div>        
        <div class='hint'>
          <xsl:call-template name="a:input-hints">
            <xsl:with-param name="hint" select="$hints-l10n[@key='mbox']"/>
          </xsl:call-template>
          <div class="spacer"/>
        </div>
        <div class="spacer"/>
      </div>      
      <div class='value'>
        <xsl:choose>
          <xsl:when test="substring(.,1,7)='mailto:'">
            <input class='large' type="text" value="{substring(.,8)}" name="mbox"/>
          </xsl:when>
          <xsl:otherwise>
            <input class='large' type="text" value="{.}" name="mbox"/>
          </xsl:otherwise>
        </xsl:choose>             
        <div class="spacer"/>
      </div>
      <div class='spacer'/>
    </div>
  </xsl:template>
 
</xsl:stylesheet>

